package com.zfzs.post.modules.address.repository;

import com.zfzs.post.modules.address.domain.SysCity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
* @author ck
* @date 2019-09-09
*/
public interface SysCityRepository extends JpaRepository<SysCity, Long>, JpaSpecificationExecutor {

    /**
     * 查询省数据
     */
    @Query(value = "select * from sys_city where pid = 0",nativeQuery = true)
    List<SysCity> queryProvinceList();

    /**
     * 查询市 或者 区
     */
    @Query(value = "select * from sys_city where pid = ?1",nativeQuery = true)
    List<SysCity> queryCityOrArea(Long id);
}